package com.atguigu.gulimall.seckill.scheduled;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ming
 * @create 2022/5/13
 * @description:
 */

//@Component
@Slf4j
@RestController
public class HelloSchedule {
    @Autowired
    private SeckillSkuScheduled seckillSkuScheduled;
    //定时任务默认是阻塞的
    
    /**
     * 让业务以异步的方式运行线程池
     */
    //@Async
    ///@Scheduled(cron="0/1 * * * * ? ")
    public void hello() throws InterruptedException {
        Thread.sleep(3000);
        log.info("hello");
    }
    @GetMapping("/testUpload")
    public void testUpload(){
        seckillSkuScheduled.uploadSeckillLate3Day();
    }

}
